<?php
/*
 * 模块基本类
*/
class base_model {
	public function __construct () {
	}
	/*
	 * 获取用户信息
	 * @access public
	 * @param int $id 用户ID
	 * @return mixed
	*/
	public function getUserInfo ($id) {
		static $user=array();
		if (isset($user[$id])) return $user[$id];
		$sql=getClass('mysql');
		$user=$sql->GetOne('SELECT * FROM `#@__user` WHERE id = ?',array($id));
		$usertype=$user['type'];
		$usergroup=$sql->GetOne('SELECT * FROM `#@__usergroup` WHERE id = ?',array($usertype));
		//用户节点
		$control=explode('|',trim($usergroup['control'],'|'));
		$view=array_unique(array_merge(explode('|',trim($usergroup['view'],'|')),$control)); //能控制的，必定能查看
		sort($view);

		return array('success'=>1,'name'=>$user['name'],'group'=>$usertype,'isAdmin'=>intval($user['isAdmin']),'view'=>$view,'control'=>$control);
	}
}
?>